'''
CoyoteMonitoring Monitor Zope Product
'''
from Products.CoyoteMonitoring.config import ARTICLE_GROUPS
from Products.Archetypes.public import BaseSchema, Schema
from Products.Archetypes.public import StringField, TextField
from Products.Archetypes.public import SelectionWidget, TextAreaWidget
from Products.Archetypes.public import RichWidget
from Products.Archetypes.public import BaseContent, registerType
from Products.Archetypes.Marshall import PrimaryFieldMarshaller
from Products.CMFCore import CMFCorePermissions
from config import PROJECTNAME

schema = BaseSchema +  Schema((
  StringField('group',
    vocabulary=ARTICLE_GROUPS,
    widget=SelectionWidget(),
  ),
  StringField('blurb',
    searchable=1,
    widget=TextAreaWidget(),
  ),
  TextField('body',
    searchable=1,
    required=1,
    primary=1,
    default_output_type='text/html',
    allowable_content_types=(
      'text/plain',
      'text/structured',
      'text/restructured',
      'text/html',
      'application/msword'
    ),
    widget=RichWidget(label='Body'),
  ),
), marshall=PrimaryFieldMarshaller(),)

class Monitor(BaseContent):
  """
  This is the Monitor class for the CoyoteMonitoring Zope Product
  """

  schema = schema

  actions = ({
    'id': 'view',
    'name': 'View',
    'action': 'string:${object_url}/article_view',
    'permissions': (CMFCorePermissions.View,)
  },)

registerType(Monitor, PROJECTNAME)

